//
//  LocationManager.h
//  Eakay
//
//  Created by zach on 2018/11/29.
//  Copyright © 2018年 恒天易开软件科技股份有限公司. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

NS_ASSUME_NONNULL_BEGIN

extern NSString * const EKLocationDidUpdatedLocateNotification;
extern NSString * const EKLocationDidSuccessedLocateNotification;
extern NSString * const EKLocationDidFailedLocateNotification;
extern NSString * const EKLocationDidGeoCodeNotification;
extern NSString * const EKLocationDidReverseGeoCodeNotification;

typedef NS_ENUM(NSUInteger, EKLocationManagerLocationResult) {
    EKLocationManagerLocationResultDefault,              //默认状态
    EKLocationManagerLocationResultLocating,             //定位中
    EKLocationManagerLocationResultSuccess,              //定位成功
    EKLocationManagerLocationResultFail,                 //定位失败
    EKLocationManagerLocationResultParamsError,          //调用API的参数错了
    EKLocationManagerLocationResultTimeout,              //超时
    EKLocationManagerLocationResultNoNetwork,            //没有网络
    EKLocationManagerLocationResultNoContent             //API没返回数据或返回数据是错的
};

typedef NS_ENUM(NSUInteger, EKLocationManagerLocationServiceStatus) {
    EKLocationManagerLocationServiceStatusDefault,               //默认状态
    EKLocationManagerLocationServiceStatusOK,                    //定位功能正常
    EKLocationManagerLocationServiceStatusUnknownError,          //未知错误
    EKLocationManagerLocationServiceStatusUnAvailable,           //定位功能关掉了
    EKLocationManagerLocationServiceStatusNoAuthorization,       //定位功能打开，但是用户不允许使用定位
    EKLocationManagerLocationServiceStatusNoNetwork,             //没有网络
    EKLocationManagerLocationServiceStatusNotDetermined          //用户还没做出是否要允许应用使用定位功能的决定，第一次安装应用的时候会提示用户做出是否允许使用定位功能的决定
};


@interface LocationManager : NSObject

@property (nonatomic, assign, readonly) CLLocationCoordinate2D locatedCoordinate;

@property (nonatomic, copy, readonly) NSString *locatedCityName;
@property (nonatomic, copy, readonly) NSString *locatedDistrictName;

+ (instancetype)shared;

/** 百度地图授权 */
- (BOOL)startMapManagerWithKey:(NSString *)appKey;

/** 启动定位服务 */
- (void)startLocation;
- (void)stopLocation;
- (void)restartLocation;

/** geo检索/反geo */
- (void)geoCityName:(NSString *)selectedCityName;
- (void)geoReverseLocation:(CLLocationCoordinate2D)selectdLocationCoordinate;

@end

NS_ASSUME_NONNULL_END
